< previous page page_48 next page >

Page 48
Example program FastView, shown in Figure 1.28, uses an image control and the LoadPicture function to display the contents of a graphic file. Use the drive, directory, and file list boxes to select the file you want to display. When you click on the name of a file, the program uses the LoadPicture function to load the file into the image control.
Label Control
You can use the label control to display text instead of using the Print method. You can use the font properties described earlier to change the label's appearance.
If you set a label control's AutoSize property to true, the control resizes to fit the text it contains. If you later change the text within the control by setting its Caption property to a new string value, Visual Basic resizes the control to fit the new text.
Line Control
A line control draws a line on the form or picture box that contains it. You can use line controls to display a few lines without going to the trouble of drawing them using the Line method during the Paint event.
The properties that determine a Line control's position are X1, Y1, X2, and Y2. The line connects the points (X1, Y1) and (X2, Y2).
You can use the Line's BorderStyle and BorderWidth properties to determine how the line is displayed. These properties are similar to DrawStyle and DrawWidth described earlier. You can also use the BorderColor property to specify the color the line should have. This property is similar to ForeColor described earlier.
0048-01.jpg
Figure 1.28
Example program FastView uses LoadPicture to quickly display image files.

 
< previous page page_48 next page >